from django.db import models

StrategyChoices = (
    ('cycle', '周期执行'),
    ('time', '定时执行')
)


# Create your models here.
class Task(models.Model):
    name = models.CharField("任务名", max_length=128)
    strategy = models.CharField("执行策略", max_length=4, choices=StrategyChoices)
    strategy_val = models.CharField("策略值", max_length=32)
    tool_type = models.CharField("工具类型", max_length=64)
    tool_name = models.CharField("工具名称", max_length=64)

    class Meta:
        db_table = 'task'
        verbose_name = '任务表'
        verbose_name_plural = verbose_name


class TaskResourcesRelations(models.Model):
    task_id = models.ForeignKey(verbose_name="所属任务", to=Task, on_delete=models.CASCADE)
    resource_id = models.CharField("资源ID", max_length=64)
    certificate = models.TextField("凭证")


